{include file="public/header"}
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>商家活动任务认证</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/tt.css" />
    <style>
        .hidden {
            display: none !important;
        }
        html,
        body {
            width: 100%;
            background: rgba(238, 238, 238, 1);
            margin:0;
            padding:0;
            word-wrap: break-word;
            word-break: break-all;
        }
        .container{
            padding-top:30px;
            padding-bottom:80px;
        }
        .box{
            width:1200px;
            /*height:800px;*/
            padding-bottom:80px;
            background:#fff;
            border-radius:3px;
            margin:0 auto;
            padding-top:50px;
            box-sizing: border-box;
        }
        .content{
            margin-bottom:30px;
            display: flex;
            align-items: center;
        }
        .leftItem{
            width:184px;
            font-size:14px;
            color:#333;
            font-weight:500;
            text-align:right;
            margin-right:30px;
        }
        .inputt{
            width:520px;
            height:34px;
            border:1px solid #ccc;
            border-radius:3px;
            box-sizing: border-box;
            padding-left:10px;
            outline:none;
        }
        .addPic{
            width:102px;
            height:102px;
        }
        .yzm{
            width:160px;
            height:34px;
            border:1px solid #ccc;
            border-radius:3px;
            box-sizing: border-box;
            margin-right:30px;
            padding-left:10px;
            font-size:12px;
            color:#333;
        }
        .yzm::-webkit-input-placeholder{
            font-size:12px;
            color:#ccc;
        }
        .code{
            width:100px;
            height:34px;
            line-height:34px;
            text-align:center;
            background:#0065F0;
            border-radius:3px;
            font-size:14px;
            color:#fff;
        }
        .btn{
            margin-left:214px;
            width:130px;
            height:34px;
            line-height:34px;
            text-align: center;
            font-size:12px;
            color:#fff;
            background:#0065F0;
            border-radius:3px;
        }
        .xxx{
            margin-left:214px;
            width:400px;
            height:34px;
            line-height:34px;
            text-align: left;
            font-size:12px;
            color:gray;
        }
        .item4_middle{
            display:flex;
        }
        .add{
            position: relative;
            margin-left:10px;
        }
        .delete{
            width:100%;
            height:24px;
            line-height:24px;
            text-align:center;
            position: absolute;
            bottom:0;
            left:0;
            background:rgba(0,0,0,0.4);
            color:#fff;
            font-size:12px;
        }
        .code_gray{
            color:#ccc;
        }
    </style>
</head>

<body>
<header class="wrap3">
    <div class="tt_top3">
        <div class="tt_top33">商家中心 > 活动任务认证</div>
    </div>
</header>
<form id="fabutask">
<div class="container">
    <div class="box">
        <div class="content">
            <div class="leftItem">活动类型</div>
            <input type="text" class="inputt company" name="company" value="{$data['s_active_type']}" minlength="2" maxlength="20">
        </div>


        <div class="content">
            <div class="leftItem">联系人姓名</div>
            <input type="text" class="inputt username" name="username" value="{$data['s_active_name']}" minlength="2" maxlength="25">
        </div>
        <div class="content">
            <div class="leftItem">联系人电话</div>
            <!--<input type="text" class="inputt ">-->
            <input type="text" name="phone" class="inputt phone" id="phone1" placeholder="手机号" maxlength="11" oninput="value=value.replace(/[^\d]/g,'')" value="{$data['s_active_phone']}">
            <div class="block icon_hide">
                <div class="warning" style="color:red">请输入正确的手机号</div>
            </div>
        </div>
        <div class="btn" style="cursor: pointer">提交</div>
        <div class="xxx">
            <!--<input type="checkbox" value="1" />-->
            提交代表同意<span style="cursor: pointer;color: cornflowerblue;" onclick="location.href='{:url('shop/Center/active_xieyi')}'">《发布活动协议》</span></div>

    </div>
</div>
</form>
</body>
{include file="public/footer"}

</html>
<script>
    $('.btn').click(function () {
        if($(this).text() == '提交'){
            var company = $(".company").val().trim();
            var username = $(".username").val();
            var phone = $(".phone").val();
            if(company==''){
                alert("活动类型不能为空");
                return false;
            }
            if(username==''){
                alert("联系人姓名不能为空");
                return false;
            }
            if(phone==''){
                alert("联系人电话不能为空");
                return false;
            }else{
                var pattern = /^1[3456789]\d{9}$/;
                if(!pattern.test(phone)){
                    alert("请输入正确的手机号码");
                    return false;
                }
            }
            var formData = $( "#fabutask" ).serialize();
            $(this).attr('disabled','disabled').html('提交中...');
            $.ajax({
                url: '/shop/Center/activeAsk',
                data: formData,
                type: 'POST',
                dataType: 'JSON',
                success: function (returnData) {
                    alert(returnData.msg);
                    if(returnData.code == 200){
                        window.location.href = '/shop/Center/centerPage';
                    }else{
                        $('.btn').html('提交');
                    }
                },
                error: function () {
                    alert('服务器错误，请刷新重试！');
                }
            })
        }

//        }
    });
</script>